/* This is a generated file. Don't edit. Edit the source instead.
 */

#include <stdlib.h>
#include <stdio.h>
#include <inttypes.h>
#include "io.h"
#include "log.h"
#include "ui.h"

int ui_send_search_response(ui_t *ui, int id, const char *hub_address, const char *nick, const char *filename, int filetype, uint64_t size, int openslots, int totalslots, const char *tth, const char *speed)
{
    int rc = ui_send_command(ui, "search-response$%d$%s$%s$%s$%d$%"PRIu64"$%d$%d$%s$%s|", id, hub_address ? hub_address : "", nick ? nick : "", filename ? filename : "", filetype, size, openslots, totalslots, tth ? tth : "", speed ? speed : "");
    return rc;
}

int ui_send_user_logout(ui_t *ui, const char *hub_address, const char *nick)
{
    int rc = ui_send_command(ui, "user-logout$%s$%s|", hub_address ? hub_address : "", nick ? nick : "");
    return rc;
}

int ui_send_user_login(ui_t *ui, const char *hub_address, const char *nick, const char *description, const char *tag, const char *speed, const char *email, uint64_t share_size, int is_operator, unsigned int extra_slots)
{
    int rc = ui_send_command(ui, "user-login$%s$%s$%s$%s$%s$%s$%"PRIu64"$%u$%u|", hub_address ? hub_address : "", nick ? nick : "", description ? description : "", tag ? tag : "", speed ? speed : "", email ? email : "", share_size, is_operator, extra_slots);
    return rc;
}

int ui_send_user_update(ui_t *ui, const char *hub_address, const char *nick, const char *description, const char *tag, const char *speed, const char *email, uint64_t share_size, int is_operator, unsigned int extra_slots)
{
    int rc = ui_send_command(ui, "user-update$%s$%s$%s$%s$%s$%s$%"PRIu64"$%u$%u|", hub_address ? hub_address : "", nick ? nick : "", description ? description : "", tag ? tag : "", speed ? speed : "", email ? email : "", share_size, is_operator, extra_slots);
    return rc;
}

int ui_send_public_message(ui_t *ui, const char *hub_address, const char *nick, const char *message)
{
    int rc = ui_send_command(ui, "public-message$%s$%s$%s|", hub_address ? hub_address : "", nick ? nick : "", message ? message : "");
    return rc;
}

int ui_send_private_message(ui_t *ui, const char *hub_address, const char *my_nick, const char *remote_nick, const char *remote_display_nick, const char *message)
{
    int rc = ui_send_command(ui, "private-message$%s$%s$%s$%s$%s|", hub_address ? hub_address : "", my_nick ? my_nick : "", remote_nick ? remote_nick : "", remote_display_nick ? remote_display_nick : "", message ? message : "");
    return rc;
}

int ui_send_filelist_finished(ui_t *ui, const char *hub_address, const char *nick, const char *filename)
{
    int rc = ui_send_command(ui, "filelist-finished$%s$%s$%s|", hub_address ? hub_address : "", nick ? nick : "", filename ? filename : "");
    return rc;
}

int ui_send_hubname(ui_t *ui, const char *hub_address, const char *new_name)
{
    int rc = ui_send_command(ui, "hubname$%s$%s|", hub_address ? hub_address : "", new_name ? new_name : "");
    return rc;
}

int ui_send_status_message(ui_t *ui, const char *hub_address, const char *message, ...)
{
    return_val_if_fail(message, 0);
    va_list ap;
    va_start(ap, message);
    char *v_message = 0;
    vasprintf(&v_message, message, ap);
    va_end(ap);
    int rc = ui_send_command(ui, "status-message$%s$%s|", hub_address ? hub_address : "", v_message);
    free(v_message);
    return rc;
}

int ui_send_download_starting(ui_t *ui, const char *hub_address, const char *nick, const char *remote_filename, const char *local_filename, uint64_t filesize)
{
    int rc = ui_send_command(ui, "download-starting$%s$%s$%s$%s$%"PRIu64"|", hub_address ? hub_address : "", nick ? nick : "", remote_filename ? remote_filename : "", local_filename ? local_filename : "", filesize);
    return rc;
}

int ui_send_upload_starting(ui_t *ui, const char *hub_address, const char *nick, const char *local_filename, uint64_t filesize)
{
    int rc = ui_send_command(ui, "upload-starting$%s$%s$%s$%"PRIu64"|", hub_address ? hub_address : "", nick ? nick : "", local_filename ? local_filename : "", filesize);
    return rc;
}

int ui_send_download_finished(ui_t *ui, const char *local_filename)
{
    int rc = ui_send_command(ui, "download-finished$%s|", local_filename ? local_filename : "");
    return rc;
}

int ui_send_directory_finished(ui_t *ui, const char *target_directory)
{
    int rc = ui_send_command(ui, "directory-finished$%s|", target_directory ? target_directory : "");
    return rc;
}

int ui_send_upload_finished(ui_t *ui, const char *local_filename)
{
    int rc = ui_send_command(ui, "upload-finished$%s|", local_filename ? local_filename : "");
    return rc;
}

int ui_send_transfer_aborted(ui_t *ui, const char *local_filename)
{
    int rc = ui_send_command(ui, "transfer-aborted$%s|", local_filename ? local_filename : "");
    return rc;
}

int ui_send_queue_add_target(ui_t *ui, const char *local_filename, uint64_t size, const char *tth, unsigned int priority)
{
    int rc = ui_send_command(ui, "queue-add-target$%s$%"PRIu64"$%s$%u|", local_filename ? local_filename : "", size, tth ? tth : "", priority);
    return rc;
}

int ui_send_queue_add_filelist(ui_t *ui, const char *nick, unsigned int priority)
{
    int rc = ui_send_command(ui, "queue-add-filelist$%s$%u|", nick ? nick : "", priority);
    return rc;
}

int ui_send_queue_add_source(ui_t *ui, const char *local_filename, const char *nick, const char *remote_filename)
{
    int rc = ui_send_command(ui, "queue-add-source$%s$%s$%s|", local_filename ? local_filename : "", nick ? nick : "", remote_filename ? remote_filename : "");
    return rc;
}

int ui_send_queue_add_directory(ui_t *ui, const char *target_directory, const char *nick)
{
    int rc = ui_send_command(ui, "queue-add-directory$%s$%s|", target_directory ? target_directory : "", nick ? nick : "");
    return rc;
}

int ui_send_queue_remove_target(ui_t *ui, const char *local_filename)
{
    int rc = ui_send_command(ui, "queue-remove-target$%s|", local_filename ? local_filename : "");
    return rc;
}

int ui_send_queue_remove_directory(ui_t *ui, const char *target_directory)
{
    int rc = ui_send_command(ui, "queue-remove-directory$%s|", target_directory ? target_directory : "");
    return rc;
}

int ui_send_queue_remove_filelist(ui_t *ui, const char *nick)
{
    int rc = ui_send_command(ui, "queue-remove-filelist$%s|", nick ? nick : "");
    return rc;
}

int ui_send_queue_remove_source(ui_t *ui, const char *local_filename, const char *nick)
{
    int rc = ui_send_command(ui, "queue-remove-source$%s$%s|", local_filename ? local_filename : "", nick ? nick : "");
    return rc;
}

int ui_send_hub_redirect(ui_t *ui, const char *hub_address, const char *new_address)
{
    int rc = ui_send_command(ui, "hub-redirect$%s$%s|", hub_address ? hub_address : "", new_address ? new_address : "");
    return rc;
}

int ui_send_transfer_stats(ui_t *ui, const char *local_filename, uint64_t offset, uint64_t filesize, unsigned int bytes_per_sec)
{
    int rc = ui_send_command(ui, "transfer-stats$%s$%"PRIu64"$%"PRIu64"$%u|", local_filename ? local_filename : "", offset, filesize, bytes_per_sec);
    return rc;
}

int ui_send_hub_add(ui_t *ui, const char *hub_address, const char *hub_name, const char *nick, const char *description, const char *encoding)
{
    int rc = ui_send_command(ui, "hub-add$%s$%s$%s$%s$%s|", hub_address ? hub_address : "", hub_name ? hub_name : "", nick ? nick : "", description ? description : "", encoding ? encoding : "");
    return rc;
}

int ui_send_port(ui_t *ui, int port)
{
    int rc = ui_send_command(ui, "port$%d|", port);
    return rc;
}

int ui_send_connection_closed(ui_t *ui, const char *nick, int direction)
{
    int rc = ui_send_command(ui, "connection-closed$%s$%d|", nick ? nick : "", direction);
    return rc;
}

int ui_send_connect_failed(ui_t *ui, const char *hub_address)
{
    int rc = ui_send_command(ui, "connect-failed$%s|", hub_address ? hub_address : "");
    return rc;
}

int ui_send_get_password(ui_t *ui, const char *hub_address, const char *nick)
{
    int rc = ui_send_command(ui, "get-password$%s$%s|", hub_address ? hub_address : "", nick ? nick : "");
    return rc;
}

int ui_send_share_stats(ui_t *ui, const char *path, uint64_t size, uint64_t totsize, uint64_t dupsize, unsigned int nfiles, unsigned int ntotfiles, unsigned int nduplicates)
{
    int rc = ui_send_command(ui, "share-stats$%s$%"PRIu64"$%"PRIu64"$%"PRIu64"$%u$%u$%u|", path ? path : "", size, totsize, dupsize, nfiles, ntotfiles, nduplicates);
    return rc;
}

int ui_send_server_version(ui_t *ui, const char *version)
{
    int rc = ui_send_command(ui, "server-version$%s|", version ? version : "");
    return rc;
}

int ui_send_user_command(ui_t *ui, const char *hub_address, int type, int context, const char *description, const char *command)
{
    int rc = ui_send_command(ui, "user-command$%s$%d$%d$%s$%s|", hub_address ? hub_address : "", type, context, description ? description : "", command ? command : "");
    return rc;
}

int ui_send_set_priority(ui_t *ui, const char *target_filename, unsigned int priority)
{
    int rc = ui_send_command(ui, "set-priority$%s$%u|", target_filename ? target_filename : "", priority);
    return rc;
}

int ui_send_hub_disconnected(ui_t *ui, const char *hub_address)
{
    int rc = ui_send_command(ui, "hub-disconnected$%s|", hub_address ? hub_address : "");
    return rc;
}

int ui_send_stored_filelists(ui_t *ui, const char *nicks)
{
    int rc = ui_send_command(ui, "stored-filelists$%s|", nicks ? nicks : "");
    return rc;
}

int ui_send_init_completion(ui_t *ui, int level)
{
    int rc = ui_send_command(ui, "init-completion$%d|", level);
    return rc;
}
